package edu.ccut.saturn.basevalidate.businessvalidate;

import edu.ccut.saturn.component.DefaultSaturnValidate;
import edu.ccut.saturn.component.ValidateResult;


public class EqualsValidate extends DefaultSaturnValidate {
	/**
	 * 目前支持字符串
	 */
	public void doValidate(Object value, Object[] args, ValidateResult result) {
		boolean isEqual = false;
		if (args != null && args.length > 0) {
			
			for (Object arg : args) {	
				if (value.equals(arg)) {
					isEqual = true;
					break;
				}
			}
			
			if (!isEqual) {
				sendError(_ERROR_, value, result);
			}
			
		} else {
			sendError(_ARGERROR_, value, result);
		}
	}
}
